package com.ztrue.framework.core.command;

import com.ztrue.framework.core.domain.IAggregateRoot;
import com.ztrue.framework.core.event.DomainEventStream;

/**
 * 表示一个领域事件提交上下文
 *
 * @author zhangw
 * @date 2016/12/1 14:38
 */
public class EventCommittingContext {
    /**
     * 领域对象聚合根
     */
    private IAggregateRoot aggregateRoot;

    /**
     * 领域事件流
     */
    private DomainEventStream eventStream;

    /**
     * 初始化一个领域事件提交上下文
     *
     * @param aggregateRoot
     * @param eventStream
     */
    public EventCommittingContext(IAggregateRoot aggregateRoot, DomainEventStream eventStream) {
        this.aggregateRoot = aggregateRoot;
        this.eventStream = eventStream;
    }

    /**
     * 获取领域对象聚合根
     *
     * @return
     */
    public IAggregateRoot getAggregateRoot() {
        return aggregateRoot;
    }

    /**
     * 获取领域事件流
     *
     * @return
     */
    public DomainEventStream getEventStream() {
        return eventStream;
    }
}
